<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script type="text/javascript">

    function arr(n) {
      if (n < 0) {
        return '输入错误'
      }
      else if (n == 0) {
        return 0
      }
      else if (n == 1) {
        return 1
      }
      else if (n > 1) {
        return arr(n - 1) + arr(n - 2)
        //前两个加起来等于第三个
      }

    }
    console.log(arr(6))


  </script>
</body>

</html>